package wisents.api.factory;

import java.util.ServiceLoader;

/**
 * User: paul.szulc Date: Dec 20, 2009 Time: 1:37:26 PM
 */
public abstract class Vendor {

    private static ServiceLoader<Vendor> serviceLoader = ServiceLoader.load(Vendor.class);

    public static final Vendor getInstance() {
        if (serviceLoader.iterator().hasNext()) {
            return serviceLoader.iterator().next();
        } else {
            throw new IllegalStateException("No Wisents vendor provided! Did you forgot about" +
                    " META-INF/services/wisents.api.factory.Vendor ?");
        }
    }

    public abstract ElementCriteriaFactory createElementCriteriaFactory();

}
